package com.weic.design.subject;

import com.weic.design.event.SubjectEvent;
import com.weic.design.observer.Observer;

import java.util.ArrayList;

/**
 * 孩子是具体被观察者，继承抽象被观察者
 */
public class Son extends Subject {
    public Son() {
        this.observerList = new ArrayList<>();
    }

    @Override
    public void notifyObservers(SubjectEvent subjectEvent) {
        for (Observer observer : observerList) {
            observer.response(subjectEvent);
        }
    }
}
